package org.odata4j.examples.producer.jpa.contacts;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

/**
 * A JPA annotated @Embeddalbe class to be used for the primary key of the {@link Contacts} JPA entity.
 */
@Embeddable
public class ContactsPK implements Serializable {
  private static final long serialVersionUID = 1L;

  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @Column(name = "ContactID")
  private Long ContactID;

  public ContactsPK() {}

  public ContactsPK(Long contactID) {
    this.ContactID = contactID;
  }
  
  public Long getContactId() {
    return ContactID;
  }

  public void setContactId(Long contactID) {
    this.ContactID = contactID;
  }
  
  @Override
  public int hashCode() {
    int hash = 0;
    hash += (long) ContactID;
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    if (!(object instanceof ContactsPK)) {
      return false;
    }
    ContactsPK other = (ContactsPK) object;
    if (this.ContactID != other.ContactID) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "org.odata4j.examples.producer.jpa.northwind.ContactsPK[ContactID=" + ContactID + "]";
  }
}
